package com.share.feign;

import com.share.domain.User;
//import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @desc: fallback Factory 相对于fallback 能知道fallback原因
 * @author:caifan
 * @date:2020/6/26
 */
@Component
@Slf4j
public class UserFeignFallbackFactory /*implements FallbackFactory<UserFeignClient>*/ {

    /*@Autowired
    private UserFeignClient userFeignClient;

    @Override
    public UserFeignClient create(Throwable cause) {
        log.info("fallback reason:{}", cause.getMessage());
        return new UserFeignClient() {
            @Override
            public User getUserById(Long id) {
                log.info("user fallbackfactory:{}", cause.getMessage());
                return new User();
            }
        };
    }*/
}
